<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
<!--    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
      <a-button type="primary" icon="download" @click="handleExportXls('开评标配置')">导出</a-button>
      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
        <a-button type="primary" icon="import">导入</a-button>
      </a-upload>
      &lt;!&ndash; 高级查询区域 &ndash;&gt;
      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>
      <a-dropdown v-if="selectedRowKeys.length > 0">
        <a-menu slot="overlay">
          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
        </a-menu>
        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
      </a-dropdown>
    </div>-->

    <!-- table区域-begin -->
    <div>
<!--      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>-->

      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        rowKey="bidSectionId"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="configFlag" slot-scope="text">
          {{text?'已设置':'未设置'}}
        </template>
        <span slot="action" slot-scope="text, record">
          <a @click="edit(record)">设置开评标配置</a>
        </span>

      </a-table>
    </div>

    <ex-zbwj-bid-evaluation-config-modal ref="modalForm" @ok="queryList"></ex-zbwj-bid-evaluation-config-modal>
  </a-card>
</template>

<script>

  import '@assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import ExZbwjBidEvaluationConfigModal from './modules/ExZbwjBidEvaluationConfigModal.vue'
  import {filterMultiDictText} from '@comp/dict/JDictSelectUtil'
  import { getAction } from '@api/manage'

  export default {
    name: 'ExZbwjBidEvaluationConfigList',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      ExZbwjBidEvaluationConfigModal
    },
    data () {
      return {
        description: '开评标配置管理页面',
        // 表头
        columns: [
          {
            title:'标段名称',
            align:"center",
            dataIndex: 'bidSectionName'
          },
          {
            title:'标段描述',
            align:"center",
            dataIndex: 'bidSectionContent'
          },
          {
            title:'是否设置',
            align:"center",
            dataIndex: 'configFlag',
            scopedSlots: { customRender: 'configFlag' }
          },
          // {
          //   title: '#',
          //   dataIndex: '',
          //   key:'rowIndex',
          //   width:60,
          //   align:"center",
          //   customRender:function (t,r,index) {
          //     return parseInt(index)+1;
          //   }
          // },
          // {
          //   title:'项目id',
          //   align:"center",
          //   dataIndex: 'projectId'
          // },
          // {
          //   title:'标段ID',
          //   align:"center",
          //   dataIndex: 'bidSectionId'
          // },
          // {
          //   title:'评审活动',
          //   align:"center",
          //   dataIndex: 'reviewActivity'
          // },
          // {
          //   title:'方案类别',
          //   align:"center",
          //   dataIndex: 'schemeCategory'
          // },
          // {
          //   title:'中标人数',
          //   align:"center",
          //   dataIndex: 'bidderNumber'
          // },
          // {
          //   title:'定标原则',
          //   align:"center",
          //   dataIndex: 'calibrationReason'
          // },
          // {
          //   title:'评判原则',
          //   align:"center",
          //   dataIndex: 'judgeePrinciple'
          // },
          // {
          //   title:'是否暗标 true暗标 false非',
          //   align:"center",
          //   dataIndex: 'sealedBidFlag'
          // },
          // {
          //   title:'true分步开标 false一次开表',
          //   align:"center",
          //   dataIndex: 'stepFlag'
          // },
          // {
          //   title:'综合专家',
          //   align:"center",
          //   dataIndex: 'comprehensiveExpert'
          // },
          // {
          //   title:'技术专家',
          //   align:"center",
          //   dataIndex: 'technicalExpert'
          // },
          // {
          //   title:'业主代表',
          //   align:"center",
          //   dataIndex: 'ownerExpert'
          // },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/ExZbwjBidEvaluationConfig/exZbwjBidEvaluationConfig/list",
          delete: "/ExZbwjBidEvaluationConfig/exZbwjBidEvaluationConfig/delete",
          deleteBatch: "/ExZbwjBidEvaluationConfig/exZbwjBidEvaluationConfig/deleteBatch",
          exportXlsUrl: "/ExZbwjBidEvaluationConfig/exZbwjBidEvaluationConfig/exportXls",
          importExcelUrl: "ExZbwjBidEvaluationConfig/exZbwjBidEvaluationConfig/importExcel",
          queryByProjectId:"/ExZbwjBidEvaluationConfig/exZbwjBidEvaluationConfig/queryByProjectId?projectId=",
        },
        dictOptions:{},
        superFieldList: [],
        disableMixinCreated: true,
        projectId: null
      }
    },
    created() {
      this.getSuperFieldList()
      this.projectId = this.$route.query.projectId
      this.projectName = this.$route.query.projectName
      this.queryList()
      //初始化字典配置 在自己页面定义
      this.initDictConfig();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      edit (record) {
        let params = JSON.parse(JSON.stringify(record));
        if (params.comprehensiveExpert) {
          params.comprehensiveExpert = params.comprehensiveExpert.split(',')
        } else {
          params.comprehensiveExpert = []
        }
        if (params.technicalExpert) {
          params.technicalExpert = params.technicalExpert.split(',')
        } else {
          params.technicalExpert = []
        }
        if (params.ownerExpert) {
          params.ownerExpert = params.ownerExpert.split(',')
        } else {
          params.ownerExpert = []
        }
        this.handleEdit(params)
      },
      queryList(){
        getAction(this.url.queryByProjectId+this.projectId).then((res) => {
          if (res.success) {
            console.log(res)
            //update-begin---author:zhangyafei    Date:20201118  for：适配不分页的数据列表------------
            this.dataSource = res.result.records||res.result;
            console.log(this.dataSource.length)
            if(res.result.total)
            {
              this.ipagination.total = res.result.total;
            }else{
              this.ipagination.total = 0;
            }
            //update-end---author:zhangyafei    Date:20201118  for：适配不分页的数据列表------------
          }else{
            this.$message.warning(res.message)
          }
        }).finally(() => {
          this.loading = false
        })
      },
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'bidSectionName',text:'标段名称',dictCode:''})
        fieldList.push({type:'string',value:'bidSectionContent',text:'标段描述',dictCode:''})
        fieldList.push({type:'string',value:'configFlag',text:'是否设置',dictCode:''})
        // fieldList.push({type:'string',value:'projectId',text:'项目id',dictCode:''})
        // fieldList.push({type:'string',value:'bidSectionId',text:'标段ID',dictCode:''})
        // fieldList.push({type:'int',value:'reviewActivity',text:'评审活动',dictCode:'review_activity'})
        // fieldList.push({type:'int',value:'schemeCategory',text:'方案类别',dictCode:'scheme_category'})
        // fieldList.push({type:'int',value:'bidderNumber',text:'中标人数',dictCode:''})
        // fieldList.push({type:'string',value:'calibrationReason',text:'定标原则',dictCode:''})
        // fieldList.push({type:'int',value:'judgeePrinciple',text:'评判原则',dictCode:''})
        // fieldList.push({type:'int',value:'sealedBidFlag',text:'是否暗标 true暗标 false非',dictCode:''})
        // fieldList.push({type:'int',value:'stepFlag',text:'true分步开标 false一次开表',dictCode:''})
        // fieldList.push({type:'int',value:'comprehensiveExpert',text:'综合专家',dictCode:''})
        // fieldList.push({type:'int',value:'technicalExpert',text:'技术专家',dictCode:''})
        // fieldList.push({type:'int',value:'ownerExpert',text:'业主代表',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
